﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>jb-aptech毕业设计项目</TITLE>
		<meta name="renderer" content="ie-comp">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../../css/style.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="../../css/menu.css">

		<script src="../../script/jquery-3.3.1.min.js"></script>
		<script src="../../script/common.js"></script>
		<script src="../../../js/bootstrap.min.js"></script>
		<script src="../../../js/vue.js"></script>
	</head>
	<body>
	<div id="query">
		<div class="page_title">
			权限管理 > 权限管理 > 权限查询
		</div>
			<div class="button_bar">
				<button class="common_button" onclick="help('');">
					帮助
				</button>  
				<button class="common_button" @click="bylike()">
					查询
				</button>
			</div>
			<table class="query_form_table">
				<tr>
					<th>
						权限文本
					</th>
					<td>
						<input type="text" v-model="might.might_text">
					</td>
					<th>
						权限描述
					</th>
					<td>
						<input type="text" v-model="might.might_tip">
					</td>
					<th>
						权限类型
					</th>
					<td>
						<select v-model="might.might_parent_code">
							<option value="">--请选择父节点--</option>
							<option v-for="t in typelist" :value="t.might_code">{{t.might_text}}</option>
						</select>
					</td>
				</tr>
			</table>
			<br />
			<table class="query_form_table">
				<tr>
					<th>
						权限编号
					</th>
					<th>
						权限文本
					</th>
					<th>
						权限父节点
					</th>
					<th>
						权限类型
					</th>
					<th>
						权限描述
					</th>
					<th>
						权限操作
					</th>
				</tr>
					<tr v-for="l in lists">
						<td>
							{{l.might_code}}
						</td>
						<td>
							{{l.might_text}}
						</td>
						<td>
							<span v-if="l.might_parent_code==0">ROOT_MENU</span>
							<span v-if="l.might_parent_code!=0">{{l.might_parent_code}}</span>
						</td>
						<td>
							{{l.might_icon}}
						</td>
						<td>
							{{l.might_tip}}
						</td>
						<td>
							<img
								@click="go('/html/~right/right/edit.html',l.might_code)"
								title="编辑" src="../../images/bt_edit.gif" class="op_button" />
							<img
								@click="go('/html/~right/right/detail.html',l.might_code)"
								title="查看" src="../../images/bt_deal.gif" class="op_button" />
							<img
								@click="mydel(l.might_code);"
								title="删除" src="../../images/bt_del.gif" class="op_button" />
						</td>
					</tr>
				<tr>
					<th colspan="7" class="pager">
						<div>
							共{{pageInfo.total}}条记录 每页<input value="10" size="2" v-model="pageInfo.pageSize"/>条
							第<input value="1" size="2" v-model="pageInfo.pageNum"/>页/共{{pageInfo.pages}}页
							<a href="javascrip:;" @click="bylike(1)"> 第一页</a>
							<a href="javascrip:;" @click="bylike(pageInfo.pageNum-1)" :class="{'hidden':!pageInfo.hasPreviousPage}">上一页</a>
							<a href="javascrip:;" @click="bylike(pageInfo.pageNum+1)" :class="{'hidden':!pageInfo.hasNextPage}">下一页</a>
							<a href="javascrip:;" @click="bylike(pageInfo.pages)">最后一页</a>
							转到<input style="width: 20px"  v-model="pageInfo.pageNum"/>页
							<button  type="button" @click="bylike(pageInfo.pageNum)">GO</button>
						</div>
					</th>
				</tr>
			</table>
	</div>
	</body>
<script>
	var app = new Vue({
        el:'#query',
		data:{
            typelist:[],
            lists:[],
            pageInfo:'',
            might:{
                might_text:'',
                might_tip:'',
                might_parent_code:'',
                startPage:'',
                PageSize:''
            },
		},
		methods:{
            bylike(page){
                if(page<=0){
                    page=1;
                }
                if(page>=this.pageInfo.pages){
                    page=this.pageInfo.pages;
                }
                this.might.startPage=page;
                this.might.PageSize=this.pageInfo.pageSize;
                $.getJSON("/selectSysMightBylike",this.might,function (json) {
                    app.lists=json.data.pageInfo.list;
                    app.pageInfo=json.data.pageInfo;
                });
            },
			go(value,id){
				sessionStorage.setItem("mid",id);
				location=value;
			},
            mydel(id){
                if(window.confirm("确认删除吗？")){
                    $.getJSON("/delSysMightById/"+id,function (json) {
                        if(json.code==200){
                            alert("删除成功！！！");
                            $.getJSON("/selectSysMightBylike",function (json) {
                                app.lists=json.data.pageInfo.list;
                                app.pageInfo=json.data.pageInfo;
                            });
                        }else {
                            alert("服务区异常！！！")
                        }
                    });
                }
            },
		},
		created(){
            $.getJSON("/selectSysMightBylike",function (json) {
                app.lists=json.data.pageInfo.list;
                app.pageInfo=json.data.pageInfo;
            });
            $.getJSON("/querymighttype",function (json) {
				app.typelist=json.data.typelist;
            })
		}
	})
</script>
</html>
